@extends('layouts.layouts')

<style>
    .layui-form-radio {
        margin: 0px;
    }

    .layui-form-select dl {
        z-index: 9990;
    }

    .lay-ext-mulitsel .layui-input.multiple a {
        height: auto;
    }

    .form-group {
        overflow: hidden;
    }
</style>
@section('title')
    添加配置
@endsection
@section('content')
    <div class="" style="width: 100%;background: #fff;">
        <div class="ibox ">
            <div class="ibox-content">
                <form>
                    <input type="hidden" name="callback" value="setLeader">
                    <div class="layui-inline">
                        <label class="layui-form-label" style="width: auto;">学校名</label>
                        <div class="layui-input-inline">
                            <input type="text" name="query[keywords]" value="{{$query['keywords']}}" placeholder="请输入" id="keywords" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-inline" style="padding-bottom: 5px">
                        <div class="layui-input-inline">
                            <button class="btn btn-success" type="submit">搜索</button>
                        </div>
                    </div>
                </form>
                <table class="layui-table">
                    <tbody>
                    @foreach($pager as $item)
                        <tr class="line">
                            <td><input type="checkbox" class="check_item check_item_{{$item['id']}}" data-id="{{$item['id']}}"
                                       value="{{$item['id']}}" {{($item['is_checked'] && $item['is_checked'] == 1) ? 'checked':''}}></td>
                            <td>{{$item['id']}}</td>
                            <td>
                                {{$item['name']}}
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <div style="text-align: center">
                    <input style="width: 200px" type="button" class="btn btn-success commit" value="确定">
                </div>
            </div>
        </div>
    </div>
@endsection

@section('script')
    <script>
        $(".commit").click(function () {
            layer.closeAll();
            var index = parent.layer.getFrameIndex(window.name);
            var school_ids = [];
            if (index) {
                parent.layer.close(index);
            }
            //获取选择的用户id
            var value =  $(".check_item:checked");
            value.each(function() {
                school_ids.push($(this).data('id'))
            });
            var escort_id = {{$escort_id}}
            //调用父类方法
            window.parent.{{$callback}}(school_ids,escort_id);
        });
    </script>
@endsection
